<template>
  <div class="own">
    <img class="user-poster" src="../assets/own.jpg">
    <van-image
      class="vi"
      round
      width="7rem"
      height="7rem"
      src="https://img.yzcdn.cn/vant/cat.jpeg"
    ></van-image>
    <div class="un">{{userName}}</div>
    <van-row class="user-links">
      <van-col span="6" @click="toOrder(10)">
        <van-icon name="tosend" />
        待付款
      </van-col>
      <van-col span="6" @click="toOrder(20)">
        <van-icon name="pending-payment" />
        已付款
      </van-col>
      <van-col span="6" @click="toOrder(40)">
        <van-icon name="logistics" />
        已发货
      </van-col>
      <van-col span="6" @click="toOrder(50)">
        <van-icon name="records" />
        已完成
      </van-col>
    </van-row>

    <van-cell-group class="user-group">
      <van-cell icon="edit" title="个人资料" is-link to="/eo"/>
    </van-cell-group>

    <van-cell-group>
      <van-cell icon="location-o" title="收货地址" is-link to="/address" />
      <van-cell icon="gold-coin-o" title="我的优惠券" is-link to="/cou"/>
      <van-cell icon="closed-eye" title="修改密码" is-link to="/fpwb"/>
      <van-cell icon="eye-o" title="修改密保信息" is-link to="/emb"/>
      <van-cell icon="setting-o" title="系统设置" is-link to="/setting"/>
    </van-cell-group>
  </div>
</template>

<script>
import { Row, Col, Icon, Cell, CellGroup } from 'vant';
export default {
  data(){
    return{
      userName:'未登录'
    }
  },
  methods:{
    toOrder(status){
      this.$router.push({
        name:"Order",
        params:{st:status}
      })
    }
  },
  created() {
    if(this.$store.state.us != -1){
      this.userName = this.$store.state.us.username
    }
  }
};
</script>

<style lang="less">
  .un{
    height: 40px;
    width: 120px;
    position: absolute;
    margin: auto;
    top: 150px;
    right: 0px;
    left: 0px;
    font-size: 30px;
    color: white;
    font-weight: bold;
    text-align: center;
  }
  .vi{
    position: absolute !important;
    margin: auto;
    top: 40px;
    right: 0px;
    left: 0px;
  }
.user {
  &-poster {
    width: 100%;
    height: 53vw;
    display: block;
  }
  &-group {
    margin-bottom: 15px;
  }
  &-links {
    padding: 15px 0;
    font-size: 12px;
    text-align: center;
    background-color: #fff;
    .van-icon {
      display: block;
      font-size: 24px;
    }
  }
}
</style>
